One aspect of interaction between applications and operating systems which has the potential for inefficiency is in the execution of a "sleep" function. A sleep function is typically utilized by applications to suspend execution of the application while the application waits for an event to occur. For example, in communicating between applications an application may call the sleep function while it waits for a response from another application.
Conventional sleep functions, such as SLEEP in Microsoft's Windows.RTM. and DOSSLEEP in International Business Machines OS/2.RTM., typically use a single duration for the time the application is suspended. This approach, however, can cause too much time to be spent sleeping if the duration is too large or too much time spent entering and exiting sleep mode if the duration is set too large. Furthermore, as applications may run on different platforms with different characteristics, it may be impossible to determine in advance a single sleep duration which provides the correct balance between too long a duration and too short a duration.
Even if a single platform could be anticipated, variations in session specific characteristics such as the number and nature of other applications executing on the system can also affect the needed sleep duration. Thus, if an application uses a single sleep duration for all situations, it is likely that this duration will not provide efficient use of system resources as either too many sleep calls will be made, thus utilizing processor resources for entering and leaving sleep mode, or too few sleep calls will be made, thus causing too long a suspension of the application to occur.
In light of these limitations of existing sleep mode functions, a need exists for improved methods of suspending execution of an application to wait for the occurrence of an event.